import time
import requests

head = {"Connection": "keep-alive"}
url = "http://127.0.0.1:9988"

client = requests.session()
while True:
    try:
        r = client.get(url, headers=head)
        print(r.status_code)
        print(r.text)
        time.sleep(1)
    except requests.exceptions.ConnectionError:
        print("异常断开连接")
        break
    except Exception as e:
        print("未知异常", e)
        break

""" 测试\
2次请求, 抓包只发了一次tcp.syn 请求, 沿用了之前的tcp连接
"""
